package cn.sm1234.exception;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

import java.util.Properties;

@Configuration
public class MySimpleMappingExceptionResolver {

    @Bean
    public SimpleMappingExceptionResolver getSimpleMappingExceptionResolver(){
        SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver();

        Properties mappings = new Properties();

        /*参数一，必须全名， 参数二，视图名字*/
        mappings.put("java.lang.NullPointerException", "error2");
        mappings.put("java.lang.ArithmeticException", "erro1");
        return resolver;
    }
}
